package com.mocha.bss.domain.rbac.feign;

import com.coffee.core.CoffeeResponse;
import com.coffee.core.FunctionAuthBO;
import com.mocha.bss.domain.rbac.service.MochaRoleFunctionService;
import com.mocha.bss.domain.rbac.service.MochaRoleSensitiveService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author songkui
 * @since 2022-02-11
 * @version v2.0
 */
@Slf4j
@RestController
@RequestMapping("/auth")
@AllArgsConstructor
public class MochaAuthFacade {

    private final MochaRoleFunctionService mochaRoleFunctionService;
    private final MochaRoleSensitiveService mochaRoleSensitiveService;


    //角色 对应 功能权限 的 urls 【逗号隔开】
    @GetMapping("/role/function")
    public Map<String, FunctionAuthBO> findRoleFunction(){
        return mochaRoleFunctionService.findAllRolePathMap();
    }

    //角色 对应 的 铭感词 sensitiveType , 逗号隔开
    @GetMapping("/role/sensitive")
    public CoffeeResponse<Map<String, String>> findRoleSensitive(){
        return CoffeeResponse.responseSuccess(mochaRoleSensitiveService.getRoleSensitiveMap());
    }


}
